import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import usePluginImport from 'vite-plugin-importer';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    // 路径别名
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  server: {
    port: 8888,
    open: true,
  },
  plugins: [
    reactRefresh(),
    // eslint-disable-next-line react-hooks/rules-of-hooks
    usePluginImport({
      libraryName: 'antd',
      libraryDirectory: 'es',
      style: 'css',
    }),
  ],
});
